var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2kc = require("kc");
var $2pvzChannel = require("pvzChannel");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_pvzHtItem = /* */function (_cc$Component89) {
  babel_inherits(r, _cc$Component89);
  var _super123 = babel_createSuper(r);
  function r() {
    var _this294;
    babel_classCallCheck(this, r);
    _this294 = _super123.apply(this, arguments);
    _this294.pic = null;
    _this294.txt = null;
    _this294.jumpKey = null;
    _this294.sp = null;
    _this294.box = null;
    return _this294;
  }
  babel_createClass(r, [{
    key: "onLoad",
    value: function onLoad() {
      var _this295 = this;
      this.node.on(cc.Node.EventType.TOUCH_END, function () {
        _this295.jumpKey && $2pvzChannel.pvzChannel.instance().jumpTo(_this295.jumpKey);
      });
    }
  }, {
    key: "set",
    value: function set(e, t, a) {
      var _this296 = this;
      this.node.parent = e;
      this.txt.string = t.txt;
      this.jumpKey = t.jumpKey;
      this.box = a;
      if (!this.sp) {
        if (a.spMap.has(t.iconUrl)) {
          this.sp = a.spMap.get(t.iconUrl);
          return void (this.pic.spriteFrame = this.sp);
        }
        cc.assetManager.loadRemote(t.iconUrl, {
          ext: "." + $2kc.default.picType
        }, function (e, n) {
          if (e) {
            $2kc.default.err("加载icon失败:" + t.iconUrl);
            return void $2kc.default.err("" + e);
          }
          var s = new cc.SpriteFrame(n);
          _this296.pic.spriteFrame = s;
          _this296.sp = s;
          a.spMap.set(t.iconUrl, s);
          _this296.pic.node.width = 150;
          _this296.pic.node.height = 150;
          $2kc.default.log("加载icon成功2:" + t.iconUrl);
        });
      }
    }
  }]);
  return r;
}(cc.Component);
cc__decorate([ccp_property(cc.Sprite)], def_pvzHtItem.prototype, "pic", undefined);
cc__decorate([ccp_property(cc.Label)], def_pvzHtItem.prototype, "txt", undefined);
def_pvzHtItem = cc__decorate([ccp_ccclass], def_pvzHtItem);
exports.default = def_pvzHtItem;